package com.eastedu.repository.basic.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.eastedu.model.basic.ResourceFile;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * 〈〉
 *
 * @author ZHISHUAI.ZHANG
 * @since 2021 /8/2
 */
@Slf4j
@Data
@Table(name = "t_basic_resource_file")
@TableName("t_basic_resource_file")
public class BasicResourceFilePO {
    @Id
    private Long id;
    private String basicResourceId;
    private String fileId;
    private Long size;
    private String md5;
    private String fileName;
    private String extension;
    private Long createTime;
    private Long updateTime;
    private String downloadUrl;
    private String previewUrl;
    private Long duration;
    private Boolean encryption;


    /**
     * To file resource file.
     *
     * @return the resource file
     */
    public ResourceFile toFile() {
        ResourceFile file = new ResourceFile();
        file.setId(String.valueOf(this.id));
        file.setBasicResourceId(String.valueOf(this.basicResourceId));
        file.setFileId(this.fileId);
        file.setSize(this.size);
        file.setMd5(this.md5);
        file.setFileName(this.fileName);
        file.setExtension(this.extension);
        file.setDownloadUrl(this.downloadUrl);
        file.setPreviewUrl(this.previewUrl);
        file.setDuration(this.duration);
        file.setEncryption(this.encryption);
        file.setCreateTime(this.createTime);
        file.setUpdateTime(this.updateTime);
        return file;
    }
}